package com.ruoyi.common.core.domain.entity;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 系统用户信息对象 zx_sysuser
 *
 * @author ruoyi
 * @date 2021-05-22
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 标识ID */
    private Long uId;

    /** 登陆账户 */
    @Excel(name = "登陆账户")
    private String loginName;

    /** 登陆密码 */
    @Excel(name = "登陆密码")
    private String loginPawd;

    /** 用户真实姓名 */
    @Excel(name = "用户真实姓名")
    private String trueName;

    /** 用户电话 */
    @Excel(name = "用户电话")
    private String uPhone;

    /** 所属机构标识，0为管理员 */
    @Excel(name = "所属机构标识，0为管理员")
    private Integer itId;
    /** 用户真实姓名 */
    @Excel(name = "机构名称姓名")
    private String itName;

    /** 用户角色权限 */
    @Excel(name = "用户角色权限")
    private Long srId;

    /** -1禁用1启用 */
    @Excel(name = "-1禁用1启用")
    private Integer uStatus;

    /** 过期日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date overDate;

    /** 最后登陆时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastDate;

    /** 最后登陆IP */
    @Excel(name = "最后登陆IP")
    private String lastIp;

    /** 开通时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "开通时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date time;

    public void setuId(Long uId)
    {
        this.uId = uId;
    }

    public Long getuId()
    {
        return uId;
    }
    public void setLoginName(String loginName)
    {
        this.loginName = loginName;
    }

    public String getLoginName()
    {
        return loginName;
    }
    public void setLoginPawd(String loginPawd)
    {
        this.loginPawd = loginPawd;
    }

    public String getLoginPawd()
    {
        return loginPawd;
    }
    public void setTrueName(String trueName)
    {
        this.trueName = trueName;
    }

    public String getTrueName()
    {
        return trueName;
    }
    public void setuPhone(String uPhone)
    {
        this.uPhone = uPhone;
    }

    public String getuPhone()
    {
        return uPhone;
    }
    public void setItId(Integer itId)
    {
        this.itId = itId;
    }

    public Integer getItId()
    {
        return itId;
    }
    public void setSrId(Long srId)
    {
        this.srId = srId;
    }

    public Long getSrId()
    {
        return srId;
    }
    public void setuStatus(Integer uStatus)
    {
        this.uStatus = uStatus;
    }

    public Integer getuStatus()
    {
        return uStatus;
    }
    public void setOverDate(Date overDate)
    {
        this.overDate = overDate;
    }

    public Date getOverDate()
    {
        return overDate;
    }
    public void setLastDate(Date lastDate)
    {
        this.lastDate = lastDate;
    }

    public Date getLastDate()
    {
        return lastDate;
    }
    public void setLastIp(String lastIp)
    {
        this.lastIp = lastIp;
    }

    public String getLastIp()
    {
        return lastIp;
    }
    public void setTime(Date time)
    {
        this.time = time;
    }

    public Date getTime()
    {
        return time;
    }
    public boolean isAdmin()
    {
        return isAdmin(this.uId);
    }

    public static boolean isAdmin(Long uId)
    {
        return uId != null && 1L == uId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("uId", getuId())
                .append("loginName", getLoginName())
                .append("loginPawd", getLoginPawd())
                .append("trueName", getTrueName())
                .append("uPhone", getuPhone())
                .append("itId", getItId())
                .append("srId", getSrId())
                .append("uStatus", getuStatus())
                .append("overDate", getOverDate())
                .append("lastDate", getLastDate())
                .append("lastIp", getLastIp())
                .append("time", getTime())
                .toString();
    }

    public void setItName(String itName) {
        this.itName = itName;
    }
    public String getItName() {
        return  itName;
    }
}
